/**
  ******************************************************************************
  * @file    tim.h
  * @brief   This file contains all the function prototypes for
  *          the tim.c file
  ******************************************************************************
  * @attention
  *
  * <h2><center>&copy; Copyright (c) 2023 STMicroelectronics.
  * All rights reserved.</center></h2>
  *
  * This software component is licensed by ST under BSD 3-Clause license,
  * the "License"; You may not use this file except in compliance with the
  * License. You may obtain a copy of the License at:
  *                        opensource.org/licenses/BSD-3-Clause
  *
  ******************************************************************************
  */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __TIM_H__
#define __TIM_H__

#ifdef __cplusplus
extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "main.h"

/* USER CODE BEGIN Includes */

#define GTIM_TIMX_CNT                          TIM3
#define GTIM_TIMX_CNT_IRQn                     TIM3_IRQn
#define GTIM_TIMX_CNT_IRQHandler               TIM3_IRQHandler
#define GTIM_TIMX_CNT_CHY                      TIM_CHANNEL_1                                 /* ͨ��Y,  1<= Y <=2 */
#define GTIM_TIMX_CNT_CHY_CLK_ENABLE()         do{ __HAL_RCC_TIM3_CLK_ENABLE(); }while(0)    /* TIM3 ʱ��ʹ�� */
/* USER CODE END Includes */

extern TIM_HandleTypeDef htim1;
extern TIM_HandleTypeDef htim3;
extern TIM_HandleTypeDef htim14;
extern TIM_HandleTypeDef htim16;

/* USER CODE BEGIN Private defines */

/* USER CODE END Private defines */

void MX_TIM1_Init(void);
void MX_TIM3_Init(void);
void MX_TIM14_Init(void);
void MX_TIM16_Init(void);

/* USER CODE BEGIN Prototypes */
uint32_t GetSystem1msCount(void);
uint32_t CalculateTime( uint32_t nNew, uint32_t nOld);
void delay_us(uint32_t udelay);
void TIM1_Init(void);
void TIM3_Init(void);
uint32_t GetTIM1Count(void);
uint32_t GetTIM3Count(void);

void TIM_Count_Clear(void);
/* USER CODE END Prototypes */

#ifdef __cplusplus
}
#endif

#endif /* __TIM_H__ */

/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
